<template>
  <div>
    <!-- 这里是接待记录 -->
    <el-form label-width="auto">
      <el-row class="top" type="flex">
        <el-col :span="search?10:7">
          <Search :data="[{name:'全部',id:'all'},{name:'今天',id:'today'},{name:'昨天',id:'yesterday'},{name:'近七天',id:'week'},{name:'近一个月',id:'month'},{name:'自定义',id:'custom'}]" @search="hanldeSearch" />
        </el-col>
        <el-col :span="4">
          <el-form-item label="渠道来源：">
            <dictionary-selector code="swan_operating_yxqx" :value.sync="searchForm.value3" @change="handle" />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="选择顾客:">
            <member-selector multiple :visible="visibleS" :value="memberList.map(item => item.id)" @cancel="handleCancel(memberList)" @confirm="handleConfirm(memberList)" />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="就诊类型:">
            <dictionary-selector code="swan_front_jzlx" :value.sync="searchForm.value3" @change="handle" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="nums">
      全院：到店10人，复查1人
    </div>
    <Table ref="table" api="/api/v1/swan/operation/accept/find/page" :params="{'timeType':type}">
      <template v-slot:default="callbackList">
        <el-table v-loading="callbackList.loading" :data="callbackList.list" style="width: 100%">
          <el-table-column prop="date" label="接待时间" />
          <el-table-column prop="customerName" label="顾客" />
          <el-table-column prop="date" label="渠道" />
          <el-table-column prop="accepterName" label="接待人员" />
          <el-table-column prop="treatType" label="就诊类型" align="center">
            <template slot-scope="scope">
              <span>{{ dictFormatter('swan_front_jzlx', scope.row.treatType) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="intentCaseName" label="意向/项目" />
          <el-table-column prop="arrangeType" label="排台类型" align="center">
            <template slot-scope="scope">
              <span>{{ dictFormatter('swan_front_ptlx', scope.row.arrangeType) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="adviserName" label="现场咨询" />
          <el-table-column prop="faceDoctorName" label="面诊医生" />
        </el-table>
      </template>
    </Table>
  </div>
</template>
<script>
import Search from '@/components/Search';
import { MemberSelector, DictionarySelector, Table } from '@rabbit.do/rabbit';
export default {
  components: {
    Search,
    MemberSelector,
    DictionarySelector,
    Table,
  },
  data() {
    return {
      search: true,
      type: 'all',
      value1: '',
      memberList: [],
      visibleS: false,
      searchForm: {
        value3: '',
      },
    };
  },
  watch: {
    defaultValue: {
      handler: function(value = []) {
        this.memberList = value;
      },
      deep: true,
      immediate: true,
    },
  },
  methods: {
    hanldeSearch(bool) {
      console.log(bool);
      this.search = bool;
    },
    handleCancel(n) {
      console.log('cancel');
      console.log(n);
    },
    handleConfirm(n) {
      console.log('confrim');
      console.log(n);
    },
    handle() {
      console.log(0);
    },
  },
};
</script>
<style lang="scss" scoped>
.top {
  > div {
    margin-right: 10px;
  }
}
</style>
